package org.example.taskmaster.fragments;

import org.example.taskmaster.database.DatabaseAdapter;

import android.app.Fragment;
import android.database.Cursor;
import android.os.Bundle;
import android.util.TypedValue;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ScrollView;
import android.widget.TextView;

public abstract class DetailsFragment extends Fragment {
	// reference to database
	protected DatabaseAdapter dbAdapter;
	protected Cursor cursor;

	protected String type;
	public DetailsFragment() {
		type = "Abstract";
	}
	public String getType() {return type;}
	
	public int getShownIndex() {
		return getArguments().getInt("index",0);
	}

	@Override
	public View onCreateView(LayoutInflater inflater, ViewGroup container,
			Bundle savedInstanceState) {
		
		if (container == null) {
			return null;
		}
		ScrollView scroller = new ScrollView(getActivity());
		TextView text = new TextView(getActivity());
		int padding = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP,4,getActivity().getResources().getDisplayMetrics());
		text.setPadding(padding, padding, padding, padding);
		scroller.addView(text);
		text.setText("This is the text. index:" + getShownIndex());
		return scroller;
	}
	
}
